<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>报工记录-会员中心 - 工厂报工系统</title>
{include file="common/header" /}

<div class="max-w-7xl mx-auto">
    <div class="bg-white rounded-lg shadow-lg p-6">
        <h3 class="text-2xl font-bold text-gray-800 mb-6">
            <i class="fa fa-list text-primary mr-2"></i> 我的报工记录
        </h3>
        
        <div class="overflow-x-auto">
            <table class="min-w-full divide-y divide-gray-200">
                <thead class="bg-gray-50">
                    <tr>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">报工时间</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">订单号</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">产品名称</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">型号名称</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">工序名称</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">报工数量</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">工价</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">工资金额</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">图片</th>
                    </tr>
                </thead>
                <tbody class="bg-white divide-y divide-gray-200">
                    {volist name="reports" id="report"}
                    <tr class="hover:bg-gray-50">
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{$report.createtime|date='Y-m-d H:i',###}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{$report.order_no|default='-'}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{$report.product_name|default='-'}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{$report.model_name|default='-'}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{$report.process_name|default='-'}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{$report.quantity}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">¥{$report.price|default=0.00}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">¥{$report.wage}</td>
                        <td class="px-6 py-4 whitespace-nowrap">
                            {if $report.status == 1}
                                <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">已确认</span>
                            {else}
                                <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800">待确认</span>
                            {/if}
                        </td>
                        <td class="px-6 py-4 whitespace-nowrap">
                          {volist name="report.images" id="img"}
                            <a href="{$img.image_url}" target="_blank">
                              <img src="{$img.image_url}" style="width:48px;height:48px;object-fit:cover;margin:2px;border-radius:4px;">
                            </a>
                            {if $report.status == 0}
                              <a href="{:url('worker/delete_report_image', ['id'=>$img.id])}" onclick="return confirm('确定删除该图片？');" style="color:red;font-size:16px;">×</a>
                            {/if}
                          {/volist}
                        </td>
                    </tr>
                    {/volist}
                </tbody>
            </table>
        </div>
        
        {if condition="empty($reports)"}
        <div class="text-center py-12">
            <i class="fa fa-inbox fa-3x text-gray-300 mb-4"></i>
            <p class="text-gray-500">暂无报工记录</p>
        </div>
        {/if}
    </div>
</div>

{include file="common/footer" /}
